namespace ext.util
{
	using System;
	using System.Runtime.CompilerServices;
	using System.Html;
	using System.Collections;
	
	
	/// <summary>
	/// The DelayedTask class provides a convenient way to &quot;buffer&quot; the execution of a method,
	/// performing setTimeout where a new timeout cancels the old timeout. When called, the
	/// task will wait the specified time period before executing. If durng that time period,
	/// the task is called again, the original call will be cancelled. This continues so that
	/// the function is only called a single time for each iteration.  This method is especially useful for things like detecting whether a user has finished
	/// typing in a text field. An example would be performing validation on a keypress. You can
	/// use this class to buffer the keypress events for a certain number of milliseconds, and
	/// perform only if they stop for that amount of time. Usage:  
	/// var task = new Ext.util.DelayedTask(function(){
	/// alert(Ext.getDom(&apos;myInputField&apos;).value.length);
	/// });
	/// // Wait 500ms before calling our function. If the user presses another key
	/// // during that 500ms, it will be cancelled and we&apos;ll wait another 500ms.
	/// ..
	/// </summary>
	/// <htmlSummary>
	/// &lt;p&gt; The DelayedTask class provides a convenient way to &quot;buffer&quot; the execution of a method,
	/// performing setTimeout where a new timeout cancels the old timeout. When called, the
	/// task will wait the specified time period before executing. If durng that time period,
	/// the task is called again, the original call will be cancelled. This continues so that
	/// the function is only called a single time for each iteration.&lt;/p&gt;
	/// &lt;p&gt;This method is especially useful for things like detecting whether a user has finished
	/// typing in a text field. An example would be performing validation on a keypress. You can
	/// use this class to buffer the keypress events for a certain number of milliseconds, and
	/// perform only if they stop for that amount of time. Usage:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
	/// var task = new Ext.util.DelayedTask(function(){
	/// alert(Ext.getDom(&apos;myInputField&apos;).value.length);
	/// });
	/// // Wait 500ms before calling our function. If the user presses another key
	/// // during that 500ms, it will be cancelled and we&apos;ll wait another 500ms.
	/// Ext.get(&apos;myInputField&apos;).on(&apos;keypress&apos;, function(){
	/// task.{@link #delay}(500);
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;Note that we are using a DelayedTask here to illustrate a point. The configuration
	/// option &lt;tt&gt;buffer&lt;/tt&gt; for {@link Ext.util.Observable#addListener addListener/on} will
	/// also setup a delayed task for you to buffer events.&lt;/p&gt;
	/// </htmlSummary>
	/// <definedin>src\ext-core\src\util\DelayedTask.js</definedin>
	[ScriptName("DelayedTask")]
	[ScriptNamespace("Ext.util")]
	[Imported()]
	public partial class DelayedTask
	{
		
		#region Constructors
		/// <summary>Constructor</summary>
		/// <param name="fn">The default function to call.</param>
		/// <param name="scope">
		/// The default scope (The <c>&lt;b&gt;this&lt;/b&gt;</c> reference) in which the
		/// function is called. If not specified, <c>this</c> will refer to the browser window.
		/// </param>
		/// <param name="args">The default Array of arguments.</param>
		public DelayedTask(System.Delegate fn, object scope, System.Array args)
		{
		}
		
		/// <summary>Constructor</summary>
		/// <param name="fn">The default function to call.</param>
		/// <param name="scope">
		/// The default scope (The <c>&lt;b&gt;this&lt;/b&gt;</c> reference) in which the
		/// function is called. If not specified, <c>this</c> will refer to the browser window.
		/// </param>
		public DelayedTask(System.Delegate fn, object scope)
		{
		}
		
		/// <summary>Constructor</summary>
		public DelayedTask()
		{
		}
		#endregion
		
		#region Methods
		/// <summary>Cancel the last queued timeout</summary>
		/// <definedin>src\ext-core\src\util\DelayedTask.js</definedin>
		[ScriptName("cancel")]
		public void Cancel()
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Cancels any pending timeout and queues a new one</summary>
		/// <definedin>src\ext-core\src\util\DelayedTask.js</definedin>
		/// <param name="delay">The milliseconds to delay</param>
		/// <param name="newFn">Overrides function passed to constructor</param>
		/// <param name="newScope">
		/// Overrides scope passed to constructor. Remember that if no scope
		/// is specified, <c>this</c> will refer to the browser window.
		/// </param>
		/// <param name="newArgs">Overrides args passed to constructor</param>
		[ScriptName("delay")]
		public void Delay(System.Number delay, System.Delegate newFn, object newScope, System.Array newArgs)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Cancels any pending timeout and queues a new one</summary>
		/// <definedin>src\ext-core\src\util\DelayedTask.js</definedin>
		/// <param name="delay">The milliseconds to delay</param>
		/// <param name="newFn">Overrides function passed to constructor</param>
		/// <param name="newScope">
		/// Overrides scope passed to constructor. Remember that if no scope
		/// is specified, <c>this</c> will refer to the browser window.
		/// </param>
		[ScriptName("delay")]
		public void Delay(System.Number delay, System.Delegate newFn, object newScope)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Cancels any pending timeout and queues a new one</summary>
		/// <definedin>src\ext-core\src\util\DelayedTask.js</definedin>
		/// <param name="delay">The milliseconds to delay</param>
		/// <param name="newFn">Overrides function passed to constructor</param>
		[ScriptName("delay")]
		public void Delay(System.Number delay, System.Delegate newFn)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Cancels any pending timeout and queues a new one</summary>
		/// <definedin>src\ext-core\src\util\DelayedTask.js</definedin>
		/// <param name="delay">The milliseconds to delay</param>
		[ScriptName("delay")]
		public void Delay(System.Number delay)
		{
			throw new System.Exception("Imported - not implemented");
		}
		#endregion
	}
}
